package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.TeachingAchievement;
import com.ruoyi.personnel.mapper.TeachingAchievementMapper;
import com.ruoyi.personnel.service.ITeachingAchievementService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 教学成果Service业务层处理
 *
 * @author ruoyi
 * @date 2021-03-03
 */
@Service
public class TeachingAchievementServiceImpl extends ServiceImpl<TeachingAchievementMapper, TeachingAchievement> implements ITeachingAchievementService {

    @Override
    public List<TeachingAchievement> queryList(TeachingAchievement teachingAchievement) {
        LambdaQueryWrapper<TeachingAchievement> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(teachingAchievement.getName())){
            lqw.like(TeachingAchievement::getName ,teachingAchievement.getName());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getJobNumber())){
            lqw.eq(TeachingAchievement::getJobNumber ,teachingAchievement.getJobNumber());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getPersonnelId())){
            lqw.eq(TeachingAchievement::getPersonnelId ,teachingAchievement.getPersonnelId());
        }
        if (teachingAchievement.getOfficeId() != null){
            lqw.eq(TeachingAchievement::getOfficeId ,teachingAchievement.getOfficeId());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getOfficeName())){
            lqw.like(TeachingAchievement::getOfficeName ,teachingAchievement.getOfficeName());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getProjectName())){
            lqw.like(TeachingAchievement::getProjectName ,teachingAchievement.getProjectName());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getAwardLevel())){
            lqw.eq(TeachingAchievement::getAwardLevel ,teachingAchievement.getAwardLevel());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getRanking())){
            lqw.eq(TeachingAchievement::getRanking ,teachingAchievement.getRanking());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getAwardDept())){
            lqw.eq(TeachingAchievement::getAwardDept ,teachingAchievement.getAwardDept());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getAwardDate())){
            lqw.eq(TeachingAchievement::getAwardDate ,teachingAchievement.getAwardDate());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getRemarks())){
            lqw.eq(TeachingAchievement::getRemarks ,teachingAchievement.getRemarks());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getEnclosure())){
            lqw.eq(TeachingAchievement::getEnclosure ,teachingAchievement.getEnclosure());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getEnclosureName())){
            lqw.like(TeachingAchievement::getEnclosureName ,teachingAchievement.getEnclosureName());
        }
        if (StringUtils.isNotBlank(teachingAchievement.getStatus())){
            lqw.eq(TeachingAchievement::getStatus ,teachingAchievement.getStatus());
        }
        return this.list(lqw);
    }
}
